<?php
class Admin extends Vnf_Db_Table{
    protected $_name;
    protected $_primary = 'AID';

    function __construct() {
        $this->_name = DB_PREFIX . "admin";
        parent::__construct(); 
    }

    public function getColumns() {
        $results = array('AID', 'Username', 'Password', 'Level', 'Email', 'FirstName', 'LastName', 'Phone', 'ActiveYN', 'CreatedDate');
        return $results;
    }

    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    
    public function getRecords($where = null, $order = null, $count = null, $offset = 0) {
        $table_name = $this->_name;
        $primary_key = $this->getPrimaryKey();
        $select = $select = Zend_Db_Table_Abstract::select();
        $select->setIntegrityCheck(false)
            ->from(array('thistable' => $table_name));
        if($where) {
            $select->where($where);
        }
        if($order) {
            $select->order($order);
        }
        if($count)
            $select->limit($count, $offset);
        $data = $this->fetchAll($select);
        return $data;
    }}
?>
